import upyun

class MyYpyun:
    def __init__(self):
        # 实例化又拍云'空间名称'，'操作员账号'，'操作员密码'
        self.up = upyun.UpYun('myupyunhsw','hsw15890172571','x1DWtRCA1OR3q5H8nfAdMgOUiz6CTuF0')

    # 上传文件
    def upload(self, id, filename, path):
        with open(path, 'rb') as f:
            self.up.put('/'+str(id)+'/'+filename,f)
myupyun = MyYpyun()
# myupyun.upload(1,'6c0.jpg',"C:/Users/胡杨/Desktop/图片/6c0.jpeg")